package com.binguo.helper;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PhoneHelper {

    public static String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$";

    public static Pattern phonePattern = Pattern.compile(regex);

    public static boolean verifyPhone(String phone){
        if (phone.length() != 11) {
            return false;
        } else {
            Matcher m = phonePattern.matcher(phone);
            boolean isMatch = m.matches();
            if (!isMatch) {
                return false;
            }
        }
        return true;
    }
}
